﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VxlEditor
{
    
    public enum Tabs { OBJECT_CREATOR, ANIMATED_OBJECT_CREATOR, WORLD_EDITOR };

    public partial class Editor : Form
    {


        public Editor()
        {
            InitializeComponent();
            
            if (!DesignMode)
            {
                this.objectCreator1.InitializeVxlComponent();                
            }

            SetupMenu();
        }

        private void SetupMenu(){
            this.menuStrip1.Items.Add(this.fileToolStripMenuItem);
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            this.objectCreator1.CleanUp();
            base.OnFormClosing(e);
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(this.tabControl.SelectedIndex == (int)Tabs.OBJECT_CREATOR){
                this.objectCreator1.New();
            }
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tabControl.SelectedIndex == (int)Tabs.OBJECT_CREATOR)
            {
                this.objectCreator1.SerializeVxlObject();
            }
        }

        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tabControl.SelectedIndex == (int)Tabs.OBJECT_CREATOR)
            {
                this.objectCreator1.DeSerializeVxlObject();
            }
        }

    }
}
